package org.dcarew.logviewer;


import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.preference.PreferencePage;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;

// TODO: preferences and all that


/**
 * 
 * 
 * @author Devon Carew
 */
public class LogViewerPreferencePage extends PreferencePage implements IWorkbenchPreferencePage
{
    private Button alwaysOpenButton;
    
    
    /**
     * 
     */
    public LogViewerPreferencePage()
    {
        this(null, null);
    }





    /**
     * @param title
     */
    public LogViewerPreferencePage(String title)
    {
        this(title, null);
    }





    /**
     * @param title
     * @param image
     */
    public LogViewerPreferencePage(String title, ImageDescriptor image)
    {
        super(title, image);
        
        noDefaultAndApplyButton();
    }





    @Override
    protected Control createContents(Composite parent)
    {
        initializeDialogUnits(parent);
        
        Composite composite = new Composite(parent, SWT.NONE);
        composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
        
        GridLayout layout = new GridLayout();
        layout.marginWidth = 0;
        layout.marginHeight = 0;
        layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
        composite.setLayout(layout);
        
        alwaysOpenButton = new Button(composite, SWT.CHECK);
        alwaysOpenButton.setText("Open Runtime Log view when the log file is written to");
        alwaysOpenButton.setSelection(true);
        
        applyDialogFont(composite);
        
        return composite;
    }





    @Override
    public void init(IWorkbench workbench)
    {
        // TODO:
        
        
    }

}
